home *** CD-ROM | disk | FTP | other *** search
- -> hooks1.e
-
- ->>> Header (globals)
-
- MODULE '*ecode_lnk'
-
- MODULE 'utility/hooks'
-
- MODULE 'utility'
-
- ENUM ERR_NONE, ERR_LIB, ERR_HOOK
-
- RAISE ERR_LIB IF OpenLibrary()=NIL
- ->>>
-
- ->>> PROC myFunction(h:PTR TO hook, o, msg)
- -> This function only prints out a message indicating that we are inside the
- -> callback function.
- PROC myFunction(h:PTR TO hook, o, msg)
- -> E-Note: installhook has set-up access to data segment
- WriteF('Inside myFunction()\n')
- ENDPROC 1
- ->>>
-
- ->>> PROC main()
- PROC main() HANDLE
- DEF h:PTR TO hook
- -> Open the utility library
- utilitybase:=OpenLibrary('utility.library', 36)
- -> Initialise the callback hook
- -> E-Note: use installhook to do the main stuff (so h.data cannot be used)
- IF (h := ECodeUtilHook({myFunction}, NIL)) = NIL THEN Raise(ERR_HOOK)
- -> Use the utility library function to invoke the hook
- CallHookPkt(h, NIL, NIL)
-
- EXCEPT DO
- IF utilitybase THEN CloseLibrary(utilitybase)
- SELECT exception
- CASE ERR_LIB; WriteF('Error: could not open utility library\n')
- CASE ERR_HOOK; WriteF('Error: could not install hook\n')
- ENDSELECT
- ENDPROC
- ->>>
-
-